package cn.rubintry.bug.hunting.adapter

import android.content.Context
import android.view.LayoutInflater
import android.view.ViewGroup
import android.widget.RelativeLayout
import android.widget.TextView
import cn.rubintry.bug.hunting.R
import com.chad.library.adapter4.BaseQuickAdapter
import com.chad.library.adapter4.viewholder.QuickViewHolder
import java.io.File

class LogListAdapter() : BaseQuickAdapter<File , QuickViewHolder>() {
    override fun onBindViewHolder(holder: QuickViewHolder, position: Int, item: File?) {
        holder.getView<TextView>(R.id.tvLogFile).text = item?.name
        holder.getView<RelativeLayout>(R.id.rlLogItem).setOnClickListener {
            onItemClick(it , position)
        }
    }

    override fun onCreateViewHolder(
        context: Context,
        parent: ViewGroup,
        viewType: Int
    ): QuickViewHolder {
        return QuickViewHolder(R.layout.item_log , parent)
    }
}